package service;

import dao.StockDao;
import entity.Stock;
import org.springframework.beans.factory.annotation.Autowired;

import javax.transaction.Transactional;

/**
 * Created by Administrator on 2016/12/20 0020.
 */
@Transactional
public class StockService {
    @Autowired
    private StockDao stockDao;

    public StockDao getStockDao() {
        return stockDao;
    }

    public void setStockDao(StockDao stockDao) {
        this.stockDao = stockDao;
    }

    public Stock addStock(Stock stock){
        stockDao.addStock(stock);
        return stock;
    }

    public Stock findProductById(int id){
        return stockDao.findProductById(id);
    }

    public void updateStock(Stock stock){
        stockDao.updateStock(stock);
    }
}
